package com.xiaochen.baidu.service.filter;

import com.xiaochen.baidu.common.design.link.ILogicHandler;
import com.xiaochen.baidu.common.design.strategy.StrategyHandler;
import com.xiaochen.baidu.model.entity.RuleCommandEntity;
import com.xiaochen.baidu.service.factory.DefaultRuleFilterFactory;
import com.xiaochen.baidu.service.node.ParseNode;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author xc
 * @date 2025/10/11/22:41
 * @desc
 */
@Service
public class ParseFilter implements ILogicHandler<RuleCommandEntity, DefaultRuleFilterFactory.RuleDynamicContext, StrategyHandler> {
    
    @Resource
    private ParseNode parseNode;
    
    @Override
    public StrategyHandler handle(RuleCommandEntity requestParameter, DefaultRuleFilterFactory.RuleDynamicContext ruleDynamicContext) throws Exception {
        if (requestParameter.getSurl() != null && requestParameter.getPwd() != null) {
            return parseNode;
        }
        return next(requestParameter, ruleDynamicContext);
    }
}
